#ifndef _HANDSTICK_HPP
#define	_HANDSTICK_HPP

#include <opencv/cv.h>

extern "C" {
#include <xdo.h>
}

#include <string>
#include <iostream>
using std::string;
using std::ostream;

#include "cvutil.hpp"
#include "parameters.hpp"


struct HandState {
  enum Distance {
    CLOSE   = -1,
    NEUTRAL =  0,
    FAR     = +1
  } distance;

  enum Direction {
    LEFT   = -1,
    MIDDLE =  0,
    RIGHT  = +1
  } direction;

  HandState();
  HandState(Distance dist, Direction dir);

  static HandState create(cv::Point2f& left, cv::Point2f& right);
};

ostream& operator<<(ostream& out, const HandState& hand_st);


class WindowController {
public:
  ~WindowController();
  
  void tracking_started();
  void update(const HandState& hand_st);
  void tracking_lost();

  static WindowController* create(const string& window_title);

protected:
  WindowController();

  xdo_t* xdo;
  Window window;
};

#endif	/* _HANDSTICK_HPP */
